namespace QMVnSoft.Lists
{
    using QMVnSoft;
    using QMVnSoft.Controls;
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class FormDmKsFilter : FormControl
    {
        private BtnControl btnCancel;
        private BtnControl btnOk;
        private IContainer components;
        private GBoxControl gBoxControl1;
        private bool ib_CheckAccepted;
        private LabelControl lblNgay_Ct2;
        private TextDate txtNgay_Ct2;

        public FormDmKsFilter()
        {
            this.InitializeComponent();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            base.Close();
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            this.CheckAccepted = true;
            base.Close();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            //ComponentResourceManager manager = new ComponentResourceManager(typeof(FormDmKsFilter));
            this.txtNgay_Ct2 = new TextDate();
            this.lblNgay_Ct2 = new LabelControl();
            this.btnCancel = new BtnControl();
            this.btnOk = new BtnControl();
            this.gBoxControl1 = new GBoxControl();
            this.gBoxControl1.SuspendLayout();
            base.SuspendLayout();
            this.txtNgay_Ct2.DateTimeFormat = TextDate.DateTimeFormatType.Date;
            this.txtNgay_Ct2.Font = new Font("Arial", 8.25f);
            this.txtNgay_Ct2.InsertKeyMode = InsertKeyMode.Overwrite;
            this.txtNgay_Ct2.Location = new Point(0xa2, 0x22);
            this.txtNgay_Ct2.Mask = "00/00/0000";
            this.txtNgay_Ct2.Name = "txtNgay_Ct2";
            this.txtNgay_Ct2.OldValue = null;
            this.txtNgay_Ct2.Size = new Size(100, 20);
            this.txtNgay_Ct2.TabIndex = 0;
//            this.txtNgay_Ct2.Value = null;//manager.GetObject("txtNgay_Ct2.Value");
            this.lblNgay_Ct2.AutoSize = true;
            this.lblNgay_Ct2.Font = new Font("Arial", 8.25f);
            this.lblNgay_Ct2.Location = new Point(0x53, 0x25);
            this.lblNgay_Ct2.Name = "lblNgay_Ct2";
            this.lblNgay_Ct2.Size = new Size(0x49, 14);
            this.lblNgay_Ct2.TabIndex = 4;
            this.lblNgay_Ct2.Text = "Ngày khóa sổ";
            this.btnCancel.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
            //this.btnCancel.DialogResult = DialogResult.Cancel;
            this.btnCancel.Font = new Font("Arial", 8.25f);
            this.btnCancel.Location = new Point(0x106, 0x74);
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.Size = new Size(0x5e, 0x17);
            this.btnCancel.TabIndex = 2;
            this.btnCancel.Text = "&Huỷ bỏ";
            this.btnCancel.UseVisualStyleBackColor = true;
            this.btnCancel.Click += new EventHandler(this.btnCancel_Click);
            this.btnOk.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
            this.btnOk.Font = new Font("Arial", 8.25f);
            this.btnOk.Location = new Point(0xa2, 0x74);
            this.btnOk.Name = "btnOk";
            this.btnOk.Size = new Size(0x5e, 0x17);
            this.btnOk.TabIndex = 1;
            this.btnOk.Text = "&Chấp nhận";
            this.btnOk.UseVisualStyleBackColor = true;
            this.btnOk.Click += new EventHandler(this.btnOk_Click);
            this.gBoxControl1.Controls.Add(this.txtNgay_Ct2);
            this.gBoxControl1.Controls.Add(this.lblNgay_Ct2);
            this.gBoxControl1.Font = new Font("Arial", 8.25f);
            this.gBoxControl1.Location = new Point(12, 12);
            this.gBoxControl1.Name = "gBoxControl1";
            this.gBoxControl1.Size = new Size(0x158, 0x59);
            this.gBoxControl1.TabIndex = 0;
            this.gBoxControl1.TabStop = false;
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.CancelButton = this.btnCancel;
            base.ClientSize = new Size(0x170, 0x97);
            base.Controls.Add(this.btnCancel);
            base.Controls.Add(this.btnOk);
            base.Controls.Add(this.gBoxControl1);
            //base.FormBorderStyle = FormBorderStyle.FixedSingle;
            base.MaximizeBox = false;
            base.MinimizeBox = false;
            base.Name = "FormDmKsFilter";
            this.Text = "Khóa sổ";
            this.gBoxControl1.ResumeLayout(false);
            this.gBoxControl1.PerformLayout();
            base.ResumeLayout(false);
        }

        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (keyData == (Keys.Control | Keys.Return))
            {
                this.CheckAccepted = true;
                base.Close();
            }
            return base.ProcessCmdKey(ref msg, keyData);
        }

        public bool CheckAccepted
        {
            get
            {
                return this.ib_CheckAccepted;
            }
            set
            {
                this.ib_CheckAccepted = value;
            }
        }

        public object Ngay_Ct2
        {
            get
            {
                if (this.txtNgay_Ct2.Value != DBNull.Value)
                {
                    AppInstance.EndWorkingDate = (DateTime) this.txtNgay_Ct2.Value;
                    return AppInstance.EndWorkingDate;
                }
                return DBNull.Value;
            }
            set
            {
                if ((value == DBNull.Value) || (value == null))
                {
                    value = AppInstance.EndWorkingDate;
                }
                this.txtNgay_Ct2.Value = value;
            }
        }
    }
}

